<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ include file="/common/common.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/sys/conf/";  //应用的地址名
String listActionName = basePath+"Config.action";
String loadDictActionName = basePath+"Config.action?op=loadDict&menuId="+request.getParameter("menuId");
String saveRegActionName = basePath+"Config.action?op=saveReg&menuId="+request.getParameter("menuId");
%>
<script type="text/javascript">
    	$(function(){
    	    $('a.href').click(function(){console.log(9)
    	    	var t = this;
    	    	window.isreturn=false;
    	    	$('a.href').each(function(){
    	    		if(t!=this&&'展开'!=$(this).text()){
    	    			$(this).click();
    	    		}
    	    	});
    	    	if(isreturn)return;
    	    	var tr = $(this).parent().parent();
    	    	var tr2 = tr.next();
    	    	if('展开'==$(this).text()){
    	    		reloadDict(tr);
    	    	}
    	    	else{
	    			if(window.dictEdit&&!confirm('您修改的内容可能尚未保存，是否要放弃修改内容?')){
	    				window.isreturn = true;return;
	    			}
    	    		$(this).text('展开').css('background','url(<%=path%>/js/jquery-easyui-1.2/themes/default/images/accordion_expand.png) no-repeat center left');
    	    		$('>td:first',tr2).empty();
        	    	tr2.css('display','none');
    	    	}
    	    }).css('background','url(<%=path%>/js/jquery-easyui-1.2/themes/default/images/accordion_expand.png) no-repeat center left');
    	    $('.mainTbl').each(function(){
    	    	if($('>tbody>tr',this).length==0){
    	    		$(this).remove();
    	    	}
    	    });
		});
    	function reloadDict(tr){
    		tr = window.dictTr = tr||window.dictTr;
	    	var tr2 = tr.next();
    		$('td:last a',tr).text('收起').css('background','url(<%=path%>/js/jquery-easyui-1.2/themes/default/images/accordion_collapse.png) no-repeat center left');
   	    	tr2.css('display','');
        	$('>td',tr2).css('border-top','0px');
        	$('>td:first',tr2).empty().load('<%=loadDictActionName%>&vcId='+tr.attr('vcId'));
    	}
    	function saveReg(idx){
    		tr = $('tr[idx='+idx+']');console.log(99)
    		vcName = $('input[name=vcName]',tr).val();
    		vcValue = $('input[name=vcValue]',tr).val();
    		$.post('<%=saveRegActionName%>',{vcName:vcName,vcValue:vcValue},function (data){
	            try{
		            jsonReStr = jQuery.parseJSON(data);  //获取从服务器得到的数据反馈信息
		            if(jsonReStr.opState=="success"){    //操作成功处理
			            $.util.showTip({content:'保存成功！'});
		            }else if(jsonReStr.opState=="failure"){  //操作失败处理
		                $.messager.alert('消息提示','操作处理失败！原因如下：<br><font color=red>'+jsonReStr.opInfo+'</font>','error');
		            }
	            }catch(e){
	               $.messager.alert('消息提示','出现系统错误!可能原因如下：<br><font color=red>'+e+'</font>','error');
	            }
    		});
    	}
    </script>
<style>
html,body{overflow:auto;}
.mainTbl{font-size:30px;text-align:left;border-bottom:1px solid #ccc;margin-top:20px;}
.mainTbl caption{font-size:20px;text-align:left;font-family:黑体;color:#444;}
.mainTbl td,.mainTbl th{font-size:12px;text-align:left;border-top:1px solid #ccc;height:25px;}
.href{display:inline-block;padding-left:16px;}
a{color:blue;}
.childTbl{table-layout:fixed;border-collapse:collapse;border:#79add2 solid 1px;}
.childTbl td,.childTbl th{border:#a2cfeb dotted 1px;padding:2px 3px;}
.childTbl input[type=text],.childTbl textarea{width:100%;height:20px;}
</style>
<html>
  <head>
    <base href="<%=basePath%>"></base>
    <title></title>
  </head> 
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<div class="panel-header" style="color:#15428B;font-size:17px;line-height:17px;">
<s:property value="#request.menuName" /> 参数配置</div>
<table style="width:100%" border="0" class="mainTbl" align="center" cellpadding="0" cellspacing="0" >
<caption>字典项维护</caption>
	<thead>
	<tr align="center" height="25">
      <th style="width:60px;text-align:center;">序号</th>
      <th width="200px">字典名称</th>
      <th>备注</th>
      <th style="width:60px;text-align:center;">操作</th>
   	</tr>
	</thead>
	<tbody>
<s:iterator value="%{#request.dlist}" id="list" status="st">
	<tr vcId='<s:property value="vcId" />'>
        <td style="text-align:center;"><s:property value="#st.index+1"/></td>
   	    <td><s:property value="vcName"/></td>
  	    <td><s:property value="vcUserData"/></td>
        <td style="text-align:center;"><a class='href' type=dict href='javascript:void(0)' vcId='<s:property value="vcId" />'>展开</a></td>
   	</tr>
	<tr style="display:none;">
        <td colspan="4" style="padding:5px;"></td>
   	</tr>
</s:iterator>
	</tbody>
</table>


<table style="width:100%" border="0" class="mainTbl" align="center" cellpadding="0" cellspacing="0" >
<caption>系统注册表维护</caption>
	<thead>
	<tr align="center" height="25">
      <th style="width:60px;text-align:center;">序号</th>
      <th style="width:150px">项目名称</th>
      <th style="width:150px">键名</th>
      <th style="width:150px">键值</th>
      <th style="width:50%">备注</th>
      <th style="width:60px;text-align:center;">操作</th>
   	</tr>
	</thead>
	<tbody>
<s:iterator value="%{#request.rlist}" id="list" status="st">
	<tr idx='<s:property value="#st.index+1" />'>
        <td style="text-align:center;"><s:property value="#st.index+1"/><input type=hidden name=vcName value='<s:property value="vcName"/>' /></td>
   	    <td><s:property value="vcId"/></td>
   	    <td><s:property value="vcName"/></td>
   	    <td><input type=text name="vcValue" value='<s:property value="vcParId"/>' /></td>
  	    <td><s:property value="vcUserData"/></td>
        <td style="text-align:center;"><a href='javascript:void(0)' onclick='saveReg(<s:property value="#st.index+1" />)'>保存</a></td>
   	</tr>
	<tr style="display:none;">
        <td colspan="4" style="padding:5px;"></td>
   	</tr>
</s:iterator>
	</tbody>
</table>


<s:if test="#request.warn!=''">
<table style="width:100%" border="0" class="mainTbl" align="center" cellpadding="0" cellspacing="0" >
<caption>系统中尚未配置的项目</caption>
	<tbody>
	<tr>
        <td style="color:red;"><s:property value="#request.warn" escape="false"/></td>
   	</tr>
	</tbody>
</table>
</s:if>
</body>
</html>
   
   

